![]() |
FSpExchangeFiles |
||||
Header: | Files.h | Carbon status: | Supported | |
Exchanges the data stored in two files on the same volume.
OSErr FSpExchangeFiles ( const FSSpec *source, const FSSpec *dest );
A pointer to an FSSpec for the source file. The contents of this file and its file information are placed in the file specified by the dest parameter.
A pointer to an FSSpec for the destination file. The contents of this file and its file information are placed in the file specified by the source parameter.
A result code.
The FSpExchangeFiles function swaps the data in two files by changing the information in the volume’s catalog and, if the files are open, in the file control blocks. You should use FSpExchangeFiles when updating an existing file, so that the file ID remains valid in case the file is being tracked through its file ID. The FSpExchangeFiles function changes the fields in the catalog entries that record the location of the data and the modification dates. It swaps both the data forks and the resource forks.
The FSpExchangeFiles function works on both open and closed files. If either file is open, FSpExchangeFiles updates any file control blocks associated with the file. Exchanging the contents of two files requires essentially the same access permissions as opening both files for writing.
The files whose data is to be exchanged must both reside on the same volume. If they do not, FSpExchangeFiles returns the result code diffVolErr.
Supported in Carbon. Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.
© 2000 Apple Computer, Inc. — (Last Updated 5/8/2000)